package cn.itcast.goods.controller.user;

import cn.itcast.goods.pojo.Category;
import cn.itcast.goods.service.CategoryService;
import cn.itcast.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Api(tags = "C端-分类接口")
@Slf4j
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    /**
     * 条件查询
     * @param type
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("条件查询")
    public Result<List<Category>> pageQuery(Integer type) {
        log.info("条件查询：{}", type);
        List<Category> list = categoryService.list(type);
        return Result.success(list);
    }
}
